//
//  AbstractWriter.h
//  NSESolver
//
//  Created by Patrick Zulian on 5/9/11.
//  Copyright 2011 ICS - USI - Lugano. All rights reserved.
//

#ifndef NSESolver_AbstractWriter_H
#define NSESolver_AbstractWriter_H

#include <iostream>
#include <string>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>

#include "Types.h"
#include "CartesianTopology.h"
#include "CFDProblem.h"

namespace nsesolver {
    
    
    class AbstractWriter {
    protected:
        typedef mpi::CartesianTopology CartesianTopology;
        typedef mpi::Communicator Communicator;
        
        const std::string path, extension;
        CartesianTopology cart;
        
        std::string intToStr( int n );
        void auxShift(Matrixd &mOut, const Matrixd &mIn, int jOffset, int iOffset) const;
    public:
        
        AbstractWriter(const std::string &path, const std::string & extension, const CartesianTopology &cart);
        
        
        virtual
        ~AbstractWriter();
        
        virtual void writeMatrix(const CFDProblem &problem, const Matrixd &m, const std::string &varName, const std::string & filename ) const
        {
            
            NSE_SOLVER_UNUSED(problem);
            NSE_SOLVER_UNUSED(m);
            NSE_SOLVER_UNUSED(varName);
            NSE_SOLVER_UNUSED(filename);
        }
        
        virtual void solverEnded(const std::vector< double > &ts, const std::vector< double > &taus);
        
        virtual void solverStarted(CFDProblem &problem) = 0;
        virtual void solverStep(CFDProblem &problem, const int q ) = 0;
    };
    
}
#endif //NSESolver_AbstractWriter_H
